#include <iostream>
#include <set>
#include <vector>
using namespace std;

vector<int> divingBoard(int shorter, int longer, int k)
{
    if (k == 0) {
	return {};
    }
    if (shorter == longer) {
	return { longer * k };
    }
    set<long long> recmap;
    vector<int> res;
    for (int i = 0; i <= k; ++i) {
	long long temp = (k - i) * shorter + (i)*longer;
	if (recmap.find(temp) == recmap.end()) {
	    recmap.insert(temp);
	    res.push_back(temp);
	}
    }
    return res;
}

int main()
{
    auto p = divingBoard(1, 2, 3);
    for (auto q = p.begin(); q != p.end(); ++q) {
	cout << *q << " ";
    }
    cout << endl;
}
